package com.px.service;

import com.px.mapper.CommodityDao;
import com.px.pojo.ShCommodity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CommodityServiceProviderImpl implements CommodityServiceProvider {
    @Resource
    private CommodityDao commodityDao;


    /**
     * 按一级分类查询商品
     *
     * @param id
     * @return
     * @throws Exception
     */
    @Override
    public List<ShCommodity> findCommodityByDic(Integer id) throws Exception {
        return commodityDao.getByDicId(id);
    }

    /**
     * 按二级分类查询商品
     *
     * @param dicId
     * @return
     * @throws Exception
     */
    @Override
    public List<ShCommodity> findByDicTwoId(Integer dicId) throws Exception {
        return commodityDao.getByDicId(dicId);
    }

    @Override
    public ShCommodity findCommentById(Integer id) throws Exception {
        return commodityDao.queryById(id);
    }
}
